// PopupMainDialog.cpp : implementation file
//

#include "stdafx.h"
#include "popup.h"
#include "PopupMainDialog.h"
#include "SenderDialog.h"
#include "PopupHistoryDialog.h"

// PopupMainDialog dialog

IMPLEMENT_DYNAMIC(PopupMainDialog, CDialog)

PopupMainDialog::PopupMainDialog(CWnd* pParent /*=NULL*/)
	: CDialog(PopupMainDialog::IDD, pParent), 
	m_parent((CpopupDlg*)pParent)
{
}

PopupMainDialog::~PopupMainDialog()
{
}

void PopupMainDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_TAB_CTRL, m_tabCtrl);
}



BOOL PopupMainDialog::OnInitDialog()
{
	UINT nScreenWidth;
	UINT nScreenHeight;
	CDialog::OnInitDialog();
	m_tabCtrl.Init();
	
	nScreenWidth = ::GetSystemMetrics(SM_CXSCREEN);
	nScreenHeight = ::GetSystemMetrics(SM_CYSCREEN);

	SetWindowPos(NULL, nScreenWidth-500, nScreenHeight-700, 0, 0, SWP_NOSIZE);
	return TRUE;
}

void PopupMainDialog::OnOK()
{
	if (m_tabCtrl.btnOkClicked())
	{
		CDialog::OnOK();
	}
}

void PopupMainDialog::updateClientStatus(const PopupClientInfo & p_client)
{
	m_tabCtrl.m_senderDialog->updateClientStatus(p_client);
}

void PopupMainDialog::clearClients()
{
	m_tabCtrl.m_senderDialog->clearClients();
}

void PopupMainDialog::appendHistory(const PopupMessageInfo & p_message,
									bool p_received)
{
	m_tabCtrl.m_historyDialog->appendHistory(p_message, p_received);
}

// PopupMainDialog message handlers
BEGIN_MESSAGE_MAP(PopupMainDialog, CDialog)
END_MESSAGE_MAP()
